<?php
/*
	
*/
defined('BY_JYA') or exit('Access Denied');
global $_RQ,$_AR;
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
if($_RQ['op']=='main'){
	if($_RQ['gamename']){
		$this->session('gamename',$_RQ['gamename']);
	}
	$gamename=$this->session('gamename');
	$params=array('pid'=>0);
	$params['gamename']=$gamename;
	$gametitle=$this->allgames2[$gamename];
	$return['params']=$params;
	$return['gametitle']=$gametitle;
	$return['p_group']=pdo_getall('jy_merch_category',array('uniacid'=>$_SESSION['uniacid']),array('id','catename'));
	set_html('title',$gametitle.'模板');
	exi($return);
}
if($_RQ['op']=='getlist'){
	$params=array('uniacid'=>$_SESSION['uniacid']);
	if($_RQ['cateid']){
		$params['cateid']=intval($_RQ['cateid']);
	}
	if($_RQ['keyword']){
		$params['title like']='%'.$_RQ['keyword'].'%';
		$return['params']['keyword']=$_RQ['keyword'];
	}
	$pindex = max(1, intval($_RQ['page']));
	$psize = 10;
	$list=pdo_getslice('jy_merch_game_tuku',$params,array($pindex,$psize),$total,$fields,'','id desc');
	if($list){
		foreach($list as &$item){
			$item['createtime']=date('Y-m-d H:i:s',$item['createtime']);
		}
	}
	$return['list']=$list;
	exi($return);
}